<?php if ($this->_var['page_info']['page_count'] > 1): ?>
<div class="page">
    <div class="items">
        <?php if ($this->_var['page_info']['prev_link']): ?>
        <a href="<?php echo $this->_var['page_info']['prev_link']; ?>" class="item prev"><i><</i><em>上一页</em></a>
        <?php else: ?>
        <a href="javascript:void(0)" class="item prev prev-disabled"><i><</i><em>上一页</em></a>
        <?php endif; ?>
        <?php if ($this->_var['page_info']['first_link']): ?>
        <a class="item" href="<?php echo $this->_var['page_info']['first_link']; ?>">1</a>
        <a href="javascript:void(0)" class="item dot">...</a>
        <?php endif; ?>
        <?php $_from = $this->_var['page_info']['page_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('page', 'link');if (count($_from)):
    foreach ($_from AS $this->_var['page'] => $this->_var['link']):
?>
        <?php if ($this->_var['page_info']['curr_page'] == $this->_var['page']): ?>
        <a class="item active" href="javascript:void(0)" ><?php echo $this->_var['page']; ?></a>
        <?php else: ?>
        <a class="item" href="<?php echo $this->_var['link']; ?>" ><?php echo $this->_var['page']; ?></a>
        <?php endif; ?>
        <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
        <?php if ($this->_var['page_info']['last_link']): ?>
        <a href="javascript:void(0)" class="item dot">...</a>
        <a class="item" href="<?php echo $this->_var['page_info']['last_link']; ?>"><?php echo $this->_var['page_info']['page_count']; ?></a>
        <?php endif; ?>
        <?php if ($this->_var['page_info']['next_link']): ?>
        <a href="<?php echo $this->_var['page_info']['next_link']; ?>" class="item next"><em>下一页</em><i>></i></a>
        <?php else: ?>
        <a href="javascript:void(0)" class="item next next-disabled"><em>下一页</em><i>></i></a>
        <?php endif; ?>
    </div>
    <div class="total">
        共<?php echo $this->_var['page_info']['page_count']; ?>页
    </div>
	
    <div class="form">
        <span class="pagetext"> 到第 </span>
        <input class="pageinput" type="number" value="<?php echo $this->_var['page_info']['curr_page']; ?>" id="page_number" min="1" max="<?php echo $this->_var['page_info']['page_count']; ?>" aria-label="页码输入框">
        <span class="pagetext">页</span>
        <span class="pagebtn" role="button" tabindex="0" onclick="page_go()">确认</span>
    </div>
</div>
<script>
    function page_go() {
        var number = $("#page_number").val();
        var params = location.search.substr(1).split('&');
        var found = false;
        for (var i = 0; i < params.length; i++)
        {
            param = params[i];
            arr = param.split('=');
            pKey = arr[0];
            if (pKey == 'page')
            {
                params[i] = 'page='+number;
                found = true;
            }
        }
        if (!found)
        {
            number = transform_char(number);
            params.push( 'page=' + number);
        }
        location.assign(SITE_URL + '/index.php?' + params.join('&'));
    }
</script>
<?php endif; ?>
